package di.scanner.mongo.dao.impl;

import com.alibaba.fastjson.JSON;
import com.mongodb.client.MongoCollection;
import di.scanner.mongo.dao.BasicDao;
import di.scanner.mongo.dao.ProviderViewDao;
import di.scanner.mongo.model.ProviderViewDI;
import org.bson.Document;

public class NewProviderViewDaoImpl extends BasicDao implements ProviderViewDao {
    private final static String TABLE_NAME = "NewProviderView";
    MongoCollection<Document> collection;

    public NewProviderViewDaoImpl(){
        super();
        collection = getDataBase().getCollection(TABLE_NAME);
    }


    public void save(ProviderViewDI result) {
        Document document = Document.parse(JSON.toJSONString(result));
        collection.insertOne(document);
    }
}
